HAL DMA secure attributes settings functions migration

This section provides information about the HAL DMA secure attributes settings operation functions migration.

HAL DMA configure security and privilege attributes function

In HAL1, the function HAL_DMA_ConfigChannelAttributes() is used to configure security and privilege attributes of a DMA channel.

In HAL2, this functionality is split into three distinct functions to separately set the security and privilege attributes as follows:

  • HAL_DMA_SetXferSecAttr() to set the security attribute for a specific transfer item either source or destination.

  • HAL_DMA_SetSecAttr() to set the security attribute for a DMA channel.

  • HAL_DMA_SetPrivAttr() to set the privilege attribute for a DMA channel.

HAL1

HAL2



HAL_StatusTypeDef HAL_DMA_ConfigChannelAttributes(DMA_HandleTypeDef *const hdma,
                                                  uint32_t ChannelAttributes)
hal_status_t HAL_DMA_SetXferSecAttr(hal_dma_channel_t instance,
                                    uint32_t item,
                                    hal_dma_sec_attr_t sec_attr);
hal_status_t HAL_DMA_SetSecAttr(hal_dma_channel_t instance,
                                hal_dma_sec_attr_t sec_attr);
hal_status_t HAL_DMA_SetPrivAttr(hal_dma_channel_t instance,
                                 hal_dma_priv_attr_t priv_attr);

HAL DMA get security and privilege attributes function

In HAL1, the function HAL_DMA_GetConfigChannelAttributes() retrieves the security and privilege attributes of a DMA channel.

In HAL2, this functionality is split into three distinct functions to separately obtain the security and privilege attributes as follows:

  • HAL_DMA_GetXferSecAttr() to get the security attribute of a specific transfer item either source or destination.

  • HAL_DMA_GetSecAttr() to get the security attribute of a DMA channel.

  • HAL_DMA_GetPrivAttr() to get the privilege attribute of a DMA channel.

HAL1

HAL2


HAL_StatusTypeDef HAL_DMA_GetConfigChannelAttributes(DMA_HandleTypeDef const *const hdma,
                                                     uint32_t *const pChannelAttributes);
hal_dma_sec_attr_t HAL_DMA_GetXferSecAttr(hal_dma_channel_t instance,
                                          uint32_t item);
hal_dma_sec_attr_t HAL_DMA_GetSecAttr(hal_dma_channel_t instance);
hal_dma_priv_attr_t HAL_DMA_GetPrivAttr(hal_dma_channel_t instance);

HAL DMA channel attributes lock function

HAL1

HAL2

HAL_StatusTypeDef HAL_DMA_LockChannelAttributes(DMA_HandleTypeDef const *const hdma)
hal_status_t HAL_DMA_LockAttr(hal_dma_channel_t instance);

HAL DMA get channel attributes lock function

In HAL1, the function HAL_DMA_GetLockChannelAttributes() retrieves the lock status of the channel attributes using a pointer to store the lock state.

In HAL2, the function HAL_DMA_IsLockedAttr() returns the lock status of the channel attributes directly as an enumeration value.

HAL1

HAL2

HAL_StatusTypeDef HAL_DMA_GetLockChannelAttributes(DMA_HandleTypeDef const *const hdma,
                                                   uint32_t *const pLockState)
hal_dma_attr_lock_status_t HAL_DMA_IsLockedAttr(hal_dma_channel_t instance);